package Player;

import Game.Bufu;
import Game.Card;
import Game.Hand;

public class SimplePlayer implements Player
{
	private Hand hand;
	private int playerID;
	private Card move;
	private Bufu bufu;
	
	public SimplePlayer()
	{
		hand = new Hand();
		bufu = new Bufu();
	}
	
	public void addCard(Card c)
	{
		hand.addCard(c);
	}
	
	public void sortCards()
	{
		hand.sortByValue();
	}
	
	public Hand getHand()
	{
		return hand;
	}
	
	public void removeCard(int p)
	{
		hand.removeCard(p);
	}

	public void removeCard(Card a)
	{
		hand.removeCard(a);
	}
	
	public Card getNextMove(Card b) 
	{
		move = null;
		for(int i = 0;i>hand.getCardCount();i++)
		{
			if(play(b, hand.getCard(i)))
			{
				move = hand.getCard(i);
				hand.removeCard(i);
			}			
		}
		return move;
	}

	
	public int getPlayerID() 
	{		
		return playerID;
	}

	
	public void setPlayerID(int thePlayer) 
	{
		playerID = thePlayer;		
	}
	
	public boolean play(Card a, Card b)
	{
		
		return bufu.canPlay(a, b);
	}

	@Override
	public Card getNextMove() {
		// TODO Auto-generated method stub
		return null;
	}

}
